package com.hspedu.tankgame5;

import java.util.Vector;

public class Hero extends Tank {
    Vector<Shot> shots = new Vector<>();
    Shot shot = null;
    //boolean isLive = true;

    public Hero(int x,int y,int direct){
        super(x,y,direct);
    }

    public void shotEnemyTank(){
        if(shots.size() == 5){
            return;
        }
        switch (getDirect()){
            case 0:
                shot = new Shot(getX() + 20,getY(),0);
                break;
            case 1:
                shot = new Shot(getX() + 60,getY() + 20,1);
                break;
            case 2:
                shot = new Shot(getX() + 20,getY()+60,2);
                break;
            case 3:
                shot = new Shot(getX(), getY() + 20, 3);
                break;

        }
        //把新创建的shot放到shots
        shots.add(shot);

        // 启动我们的Shot 线程
        new Thread(shot).start();
    }
}
